class FenceRenderer : public IBlockRenderer
{
public:
	ITexture *Texture;
	Point2i TexturePosition;

	FenceRenderer(ITexture *texture, const Point2i &pos) :
		Texture(texture),
		TexturePosition(pos)
	{
	}

	int GetTypeData(const int &data) { return data; }

	void Render(Schematic *schematic, RendererBase *renderer, const Block &block, const Point3i &position)
	{
		auto &north = schematic->GetBlock(position.X, position.Y, position.Z + 1);
		auto &south = schematic->GetBlock(position.X, position.Y, position.Z - 1);
		auto &east = schematic->GetBlock(position.X + 1, position.Y, position.Z);
		auto &west = schematic->GetBlock(position.X - 1, position.Y, position.Z);

		renderer->Draw(Box(Texture, Point3i(4, 16, 4), Point3i(6, 0, 6)).SetAll(TexturePosition));

		if (north != Block::Empty)
		{
			renderer->Draw(Box(Texture, Point3i(2, 3, 6), Point3i(7, 1, 10)).SetAll(TexturePosition));
			renderer->Draw(Box(Texture, Point3i(2, 3, 6), Point3i(7, 7, 10)).SetAll(TexturePosition));
		}

		if (east != Block::Empty)
		{
			renderer->Draw(Box(Texture, Point3i(6, 3, 2), Point3i(10, 1, 7)).SetAll(TexturePosition));
			renderer->Draw(Box(Texture, Point3i(6, 3, 2), Point3i(10, 7, 7)).SetAll(TexturePosition));
		}

		if (south != Block::Empty)
		{
			renderer->Draw(Box(Texture, Point3i(2, 3, 6), Point3i(7, 1, 0)).SetAll(TexturePosition));
			renderer->Draw(Box(Texture, Point3i(2, 3, 6), Point3i(7, 7, 0)).SetAll(TexturePosition));
		}

		if (west != Block::Empty)
		{
			renderer->Draw(Box(Texture, Point3i(6, 3, 2), Point3i(0, 1, 7)).SetAll(TexturePosition));
			renderer->Draw(Box(Texture, Point3i(6, 3, 2), Point3i(0, 7, 7)).SetAll(TexturePosition));
		}
	}
};